package myFilter;

import myFilter.dto.Request;
import myFilter.dto.Response;
import myFilter.filter.SpaceFilter;
import myFilter.filter.UpcaseFilter;

/**
 * @author yonyong
 **/
public class Fun {
    public static void main(String[] args) throws InterruptedException {
        FilterChain filterChain = new FilterChain();
        filterChain.addFilter(new UpcaseFilter());
        filterChain.addFilter(new SpaceFilter());

        Request request = new Request();
        request.setVal("welcome to NewYork!");
        Response reponse = new Response();

        filterChain.doFilter(request, reponse, filterChain);

        while (!filterChain.status) {
            // dead circle
            Thread.sleep(500);
        }
        System.out.println("final result: " + request.getVal());
    }
}
